/** TODO: Finish this problem. */
#include<algorithm>
#include<iostream>
using namespace std;
struct block {
  int h; int a; int c;
  bool operator< (const block& b2) const {
    return this->a < b2.a;
  }
};
int K;
const int maxn=40006;
bool dp[maxn];
int count[maxn];
block b[406];
int main() {
  cin>>K;
  for(int i=0; i<K; ++i) {
    cin>>b[i].h>>b[i].a>>b[i].c;
  }
  sort(b, b+K);
  for(int i=0; i<K; ++i) {
    for(int j=b[i].h; j<b[i].a; ++j) {
      if(dp[j-h[i]] && count[j]<
    }
  }
  return 0;
}
